﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
namespace Activities
{
    public sealed class CommunicateMessage : NativeActivity<string>
    {
        [RequiredArgument]
        public InArgument<string> Message { get; set; }
        public static string message;  //necessary for accessing the activity message outside the class
        protected override void Execute(NativeActivityContext context)
        {
            message = this.Message.Get(context);
            context.CreateBookmark("Message", new BookmarkCallback(OnReadComplete));
        }
        protected override bool CanInduceIdle
        {
            get { return true; }
        }
        void OnReadComplete(NativeActivityContext context, Bookmark bookmark, object state)
        {
            this.Result.Set(context, state.ToString());
        }
    }
}